package com.atguigu.lease.common.login;

/**
 * @author chengke
 * @version 1.0
 * @className LoginUserHolder
 * @description 将jwt解析结果存入threadlocal，防止重复解析
 * @date 2024/8/28 18:22
 */
public class LoginUserHolder {

    public static ThreadLocal<LoginUser> threadLocal = new ThreadLocal<>();

    public static void setLoginUser(LoginUser loginUser){
        threadLocal.set(loginUser);
    }

    public static LoginUser getLoginUser(){
        return threadLocal.get();
    }

    public static void clear(){
        threadLocal.remove();
    }

}